#! /bin/bash

INSTALL_BASE="/home/laforest/Octavo/Octavo"

TOP_LEVEL_MODULE="Dyadic_Boolean_Operator_test_bench"
TESTBENCH="./${TOP_LEVEL_MODULE}.v"

LPM_LIBRARY="$QUARTUS_BASE/quartus/eda/sim_lib/220model.v"
ALT_LIBRARY="$QUARTUS_BASE/quartus/eda/sim_lib/altera_mf.v"

SIM_DEFS="$INSTALL_BASE/Parts/SimSynth/simulation_defines.vh"

SOURCES="$INSTALL_BASE/Parts/Multiplexers/Addressed_Mux.v \
         $INSTALL_BASE/Parts/ALU/Dyadic_Boolean_Operations.vh \
         $INSTALL_BASE/Parts/ALU/Dyadic_Boolean_Operator.v
"

VLIB="work"

VSIM_ACTIONS="vcd file $TOP_LEVEL_MODULE.vcd ; vcd add -r /* ; run -all ; quit"

rm $TOP_LEVEL_MODULE.wlf $TOP_LEVEL_MODULE.vcd
vlib $VLIB 2>&1 > LOG
vlog -mfcu -incr -lint $LPM_LIBRARY $ALT_LIBRARY $SOURCES $SIM_DEFS $TESTBENCH 2>&1 >> LOG
vsim -voptargs="+acc" -c -do "$VSIM_ACTIONS" $TOP_LEVEL_MODULE 2>&1 >> LOG
vcd2wlf $TOP_LEVEL_MODULE.vcd $TOP_LEVEL_MODULE.wlf 2>&1 >> LOG
rm vsim.wlf

